home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / date / examples / exemhex0.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-04-08  |  968 b   |  48 lines

  1. unit Exemhex0;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, AdTerm, AdPort;
  8.  
  9. type
  10.   TExampleEmHex = class(TForm)
  11.     ApdComPort1: TApdComPort;
  12.     ApdTerminal1: TApdTerminal;
  13.     ApdEmulator1: TApdEmulator;
  14.     procedure ApdEmulator1ProcessChar(CP: TObject; C: Char;
  15.       var Command: TEmuCommand);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   ExampleEmHex: TExampleEmHex;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. const
  30.   Digits : array[0..$F] of Char = '0123456789ABCDEF';
  31.  
  32. function HexB(B : Byte) : string;
  33.   {-Return hex string for byte}
  34. begin
  35.   HexB[0] := #2;
  36.   HexB[1] := Digits[B shr 4];
  37.   HexB[2] := Digits[B and $F];
  38. end;
  39.  
  40. procedure TExampleEmHex.ApdEmulator1ProcessChar(CP: TObject; C: Char;
  41.   var Command: TEmuCommand);
  42. begin
  43.   Command.Cmd := eString;
  44.   Command.OtherStr := HexB(Byte(C)) + ' ';
  45. end;
  46.  
  47. end.
  48.